package com.zzt.entity;

import com.fasterxml.jackson.annotation.JsonFormat;
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
import lombok.ToString;
import org.springframework.format.annotation.DateTimeFormat;

import java.io.Serializable;
import java.util.Date;

@ToString
public class Myorder implements Serializable {
    private Integer oid;

    private Float totalprice;

    private String nickname;

    @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss",timezone = "GMT+8")
    private Date date;

    private Integer mno;

    private String[] shopNames;

    private Integer[] shopNums;

    public String[] getShopNames() {
        return shopNames;
    }

    public void setShopNames(String[] shopNames) {
        this.shopNames = shopNames;
    }

    public Integer[] getShopNums() {
        return shopNums;
    }

    public void setShopNums(Integer[] shopNums) {
        this.shopNums = shopNums;
    }

    public Myorder(Integer oid, Float totalprice, String nickname, Date date, Integer mno, String[] shopNames, Integer[] shopNums) {
        this.oid = oid;
        this.totalprice = totalprice;
        this.nickname = nickname;
        this.date = date;
        this.mno = mno;
        this.shopNames = shopNames;
        this.shopNums = shopNums;
    }

    public Integer getOid() {
        return oid;
    }

    public void setOid(Integer oid) {
        this.oid = oid;
    }

    public Float getTotalprice() {
        return totalprice;
    }

    public void setTotalprice(Float totalprice) {
        this.totalprice = totalprice;
    }

    public String getNickname() {
        return nickname;
    }

    public void setNickname(String nickname) {
        this.nickname = nickname == null ? null : nickname.trim();
    }

//    @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
//    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss",timezone = "GMT+8")
    @JsonSerialize(using = JsonDateTypeConvert.class)
    public Date getDate() {
        return date;
    }

    public void setDate(Date date) {
        this.date = date;
    }

    public Integer getMno() {
        return mno;
    }

    public void setMno(Integer mno) {
        this.mno = mno;
    }

    public Myorder(Float totalprice, String nickname, Date date, Integer mno) {
        this.totalprice = totalprice;
        this.nickname = nickname;
        this.date = date;
        this.mno = mno;
    }

    public Myorder(Integer oid, Float totalprice, String nickname, Date date, Integer mno) {
        this.oid = oid;
        this.totalprice = totalprice;
        this.nickname = nickname;
        this.date = date;
        this.mno = mno;
    }
}